/*
 * @Author: linZeJian
 * @Date: 2022-04-27 17:36:34
 * @LastEditors: linZeJian
 * @LastEditTime: 2022-04-27 17:36:46
 * @Description: 
 */

import router from './router'
import store from './store'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

NProgress.configure({
  showSpinner: false
})

// store.dispatch("user/getUser");
router.beforeEach(async (to, from, next) => {
  NProgress.start()
  // console.log('progress,store.state.isMobileState', store.state.isMobileState)
  // console.log(`to,from`, to, from)
  // pc端展示的相应页面，注意传参
  // 考虑到点击查看详情查看详细信息，不能直接替换路由，还是用pc端判断跳转
  // if (!store.state.isMobileState && to.path == "/projectDetail") {
  //   next({
  //     path: "/projectDetailPC",
  //     query: to.query
  //   })
  // }
  /* 路由发生变化修改页面title */
  if (to.meta.title) {
    document.title = to.meta.title;
  }
  next()
})

router.afterEach(() => {
  NProgress.done()
})
